package org.come.Frame;

import org.come.until.Music;
import org.come.until.MessagrFlagUntil;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import com.tool.tcpimg.UIUtils;
import javax.swing.plaf.basic.BasicInternalFrameUI;
import javax.swing.BorderFactory;
import java.awt.Container;
import org.come.until.FormsManagement;
import org.come.Jpanel.SwitchchannelsJpanel;
import java.awt.event.MouseListener;
import javax.swing.JInternalFrame;

public class FrameMessageChangeJframe extends JInternalFrame implements MouseListener
{
    private SwitchchannelsJpanel switchchannelsJpanel;
    private int first_x;
    private int first_y;

    public static FrameMessageChangeJframe getFrameMessageChangeJframe() {
        return (FrameMessageChangeJframe)FormsManagement.getInternalForm(618).getFrame();
    }

    public FrameMessageChangeJframe() {
        this.setContentPane((Container)(this.switchchannelsJpanel = new SwitchchannelsJpanel()));
        this.setBorder(BorderFactory.createEmptyBorder());
        ((BasicInternalFrameUI)this.getUI()).setNorthPane(null);
        this.setBounds(370, 160, 225, 280);
        this.setBackground(UIUtils.Color_BACK);
        this.pack();
        this.setVisible(false);
        this.setDefaultCloseOperation(3);
        this.addMouseListener((MouseListener)this);
        this.addMouseMotionListener(new MouseMotionListener() {
            @Override
            public void mouseMoved(final MouseEvent e) {
                if (MessagrFlagUntil.ImgFlagImg.equals(MessagrFlagUntil.MOUSE13)) {
                    MessagrFlagUntil.setMouse(MessagrFlagUntil.MOUSE1);
                }
            }

            @Override
            public void mouseDragged(final MouseEvent e) {
                if (FrameMessageChangeJframe.this.isVisible()) {
                    final int x = e.getX() - FrameMessageChangeJframe.this.first_x;
                    final int y = e.getY() - FrameMessageChangeJframe.this.first_y;
                    FrameMessageChangeJframe.this.setBounds(x + FrameMessageChangeJframe.this.getX(), y + FrameMessageChangeJframe.this.getY(), FrameMessageChangeJframe.this.getWidth(), FrameMessageChangeJframe.this.getHeight());
                }
            }
        });
    }

    @Override
    public void mouseClicked(final MouseEvent e) {
    }

    @Override
    public void mousePressed(final MouseEvent e) {
        FormsManagement.showForm(289);
        Music.addyinxiao("关闭窗口.mp3");
        if (e.isMetaDown()) {
            FormsManagement.HideForm(618);
        }
        else {
            FormsManagement.Switchinglevel(618);
        }
        this.first_x = e.getX();
        this.first_y = e.getY();
    }

    @Override
    public void mouseReleased(final MouseEvent e) {
    }

    @Override
    public void mouseEntered(final MouseEvent e) {
    }

    @Override
    public void mouseExited(final MouseEvent e) {
    }

    public SwitchchannelsJpanel getSwitchchannelsJpanel() {
        return this.switchchannelsJpanel;
    }

    public void setSwitchchannelsJpanel(final SwitchchannelsJpanel switchchannelsJpanel) {
        this.switchchannelsJpanel = switchchannelsJpanel;
    }

    public int getFirst_x() {
        return this.first_x;
    }

    public void setFirst_x(final int first_x) {
        this.first_x = first_x;
    }

    public int getFirst_y() {
        return this.first_y;
    }

    public void setFirst_y(final int first_y) {
        this.first_y = first_y;
    }
}
